Proper connect_port
[juce-lv2.git] / juce / source / extras / the jucer / src / properties / jucer_ColourPropertyComponent.h
blob92f44f541a3f8b1d2d6fc0f6a3fea7d05cb9b10e
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCER_COLOURPROPERTYCOMPONENT_JUCEHEADER__
27 #define __JUCER_COLOURPROPERTYCOMPONENT_JUCEHEADER__
29 #include "../utility/jucer_ColourEditorComponent.h"
32 //==============================================================================
33 /**
35 class ColourPropertyComponent : public PropertyComponent
37 public:
38 //==============================================================================
39 ColourPropertyComponent (const String& name,
40 const bool canResetToDefault)
41 : PropertyComponent (name)
43 addAndMakeVisible (new ColourPropEditorComponent (this, canResetToDefault));
46 ~ColourPropertyComponent()
48 deleteAllChildren();
51 //==============================================================================
52 virtual void setColour (const Colour& newColour) = 0;
53 virtual const Colour getColour() const = 0;
54 virtual void resetToDefault() = 0;
56 void refresh()
58 ((ColourPropEditorComponent*) getChildComponent (0))->refresh();
61 private:
62 class ColourPropEditorComponent : public ColourEditorComponent
64 ColourPropertyComponent* const owner;
66 public:
67 ColourPropEditorComponent (ColourPropertyComponent* const owner_,
68 const bool canResetToDefault)
69 : ColourEditorComponent (canResetToDefault),
70 owner (owner_)
73 ~ColourPropEditorComponent() {}
75 void setColour (const Colour& newColour)
77 owner->setColour (newColour);
80 const Colour getColour() const
82 return owner->getColour();
85 void resetToDefault()
87 owner->resetToDefault();
93 #endif // __JUCER_COLOURPROPERTYCOMPONENT_JUCEHEADER__